package com.party.core.model.notify;

import com.google.common.collect.Maps;

import java.util.Map;

/**
 * 目标模板类型枚举
 * Created by wei.li
 *
 * @date 2017/7/4 0004
 * @time 11:11
 */
public enum  TargetTemplateType {

    CROWDFUND_SUCCESS(0, "众筹成功", 0),

    CROWDFUND_UNDERWAY(1, "众筹进行中", 0),

    CROWDFUNF_ALL(3, "所有众筹", 0),

    ACT_STATUS_AUDITING(4,"审核中", 1),

    ACT_STATUS_AUDIT_PASS(5,"待支付", 1),

    ACT_STATUS_AUDIT_REJECT(6,"审核拒绝", 1),

    ACT_STATUS_PAID(7,"已支付", 1),

    ACT_STATUS_CANCEL(8,"已取消", 1),

    ACT_STATUS_ALL(9,"全部", 1),

    INTEGRAL_STATUS_ALL(10,"全部", 2),

    INTEGRAL_STATUS_CHECK(11,"已签到", 2);

    //状态码
    private Integer code;
    //状态值
    private String value;
    //类型（0:众筹，1:活动,2:积分）
    private Integer type;

    TargetTemplateType(Integer code, String value, Integer type) {
        this.code = code;
        this.value = value;
        this.type = type;
    }

    public static String getValue(Integer code){
        for (TargetTemplateType targetTemplateType : TargetTemplateType.values()){
            if (code.equals(targetTemplateType.getCode())){
                return targetTemplateType.getValue();
            }
        }
        return null;
    }

    public static TargetTemplateType get(Integer code){
        for (TargetTemplateType targetTemplateType : TargetTemplateType.values()){
            if (code.equals(targetTemplateType.getCode())){
                return targetTemplateType;
            }
        }
        return null;
    }


    public static Map<Integer, String> convertMap(Integer type){
        Map<Integer, String> map = Maps.newHashMap();
        for (TargetTemplateType targetTemplateType : TargetTemplateType.values()){
            if (type.equals(targetTemplateType.getType())){
                map.put(targetTemplateType.getCode(), targetTemplateType.getValue());
            }
        }
        map.remove(4);
        map.remove(8);
        return map;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }
}
